<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix ="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page import="com.kaishengit.util.StringUtil"%>


<html>
  <head>
  
    <title></title>
    
				<link href = "css/bootstrap.css" rel = "stylesheet" type = "text/css"/>
				
				<link href = "css/jquery-ui-1.8.16.custom.css" rel = "stylesheet"/>
			    <script type="text/javascript" src="js/jquery.js"></script>
			    <script type="text/javascript" src="js/jqueryui/jquery.ui.core.js"></script>
				<script type="text/javascript" src="js/jqueryui/jquery.ui.widget.js"></script>
				<script type="text/javascript" src="js/jqueryui/jquery.ui.datepicker.js"></script>
				<script type="text/javascript" src="js/jqueryui/jquery.ui.datepicker-zh-CN.js"></script>
				<script type="text/javascript" src="js/jqueryvalidate/jquery.validate.js"></script>
				<script type="text/javascript" src="js/jqueryvalidate/messages_cn.js"></script>
				<script type="text/javascript" src="js/bootstrap.js"></script>
  </head>
  
  <body>
 			<div class="navbar">
				<div class="navbar-inner">
					<div class="container" style="width: auto;">
						<a class="btn btn-navbar" data-target=".nav-collapse" data-toggle="collapse">
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
						</a>
						<a class="brand" href="#">品竹缘健康生活管</a>
						<div class="nav-collapse">
							<ul class="nav">
								<li class="active">
								<a href="#">显示页</a>
								</li>
								
   							</ul>
   						</div>
   					</div>
   				</div>
   			</div>
   		
		   	
   	<div class="container">
   				
		<form class="form-horizontal" action="sales.jspx" id="searchForm" method="get" style="margin-bottom:0px;">
			
			<input type="hidden" name="p" id="pageNo" value="${pager.pageNum }"/>
			<div id="myModal" class="modal hide fade in" style="dispaly:none;">
				<div class="modal-header">
					<h3>自定义搜索</h3>
				</div>
				<div class="modal-body">
					<fieldset>
						<div class="control-group">
							<label class="control-label">单位名称</label>
							<div class="controls">
								<%
									String companyname = request.getParameter("companyname");
									companyname = StringUtil.ISOtoUTF(companyname);
									
									String guidename = request.getParameter("guidename");
									guidename = StringUtil.ISOtoUTF(guidename);
									
									String address = request.getParameter("address");
									address = StringUtil.ISOtoUTF(address);
									
								 %>
								 <input type="text" name="companyname" value="<%=companyname %>"/>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label">导游名称</label>
							<div class="controls">
								<input type="text" name="guidename" value="<%=guidename %>"/>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label">客源地</label>
							<div class="controls">
								<input type="text" name="address" value="<%=address %>" />
							</div>
						</div>
						<div class="control-group">
							<label class="control-label">销售时间</label>
							<div class="controls">
								<input type="text" class="datepicker" name="starttime" value="${param.starttime}"/>&nbsp;到&nbsp;<input type="text" class="datepicker" name="endtime" value="${param.entime}" /> 
							</div>
						</div>
						<div class="control-group">
							<label class="control-label">销售额</label>
							<div class="controls">
								<input type="text" name="minmoney" value="${param.minmoney}" />&nbsp;到&nbsp;<input type="text" name="maxmoney" value="${param.maxmoney}" />
							</div>
						</div>
					</fieldset>
				</div>
				<div class="modal-footer">
					
					<input type="button" class="btn" data-dismiss="modal" value="取消"/>
					<input type="submit"  class="btn btn-info" value="搜索"/>
				</div>
			</div>
		</form>
				<div id="myModal2" class="modal hide fade in" style="dispaly:none;">
					<div class="modal-header">
						<h3>你确定要删除吗？</h3>
					</div>
					<div class="modal-footer">
						
						<input type="button" class="btn" data-dismiss="modal" value="取消"/>
						<input id="removeBtn" type="button" class="btn btn-info removeBtn" value="确定"/>
					</div>
				</div>
	
					
   				<div style="margin-left:50%">
   					<a  class="btn btn-primary" href="sales.jspx?task=list">
   					<i class="icon-home icon-white"></i>
   					
   					查看所有记录 </a>
   					<a  class="btn btn-success" href="sales.jspx?task=save">
   					<i class="icon-plus-sign icon-white"></i>
   					
   					添加新纪录</a>
   					<a class="btn btn-info" href="#myModal" data-toggle="modal">
   					<i class="icon-search icon-white"></i>
   					搜索记录</a>
   					<a  class="btn" href="sales.jspx?task=show">
   					<i class="icon-share-alt icon-white"></i>
   					
   					导出excel </a>
   				
   				</div>
   				
					<table class="table table-striped">
						<thead>
							<tr>
								<th>时间</th>
								<th>单位</th>
								<th>导游</th>
								<th>客源地</th>
								<th>人数</th>
								<th>销售额</th>
								<th>客单价</th>
								<th>&nbsp;&nbsp;&nbsp;</th>
								</tr>
						</thead>
						<tbody>
							<c:forEach items="${pager.result}" var="sales">
								<tr>
									<td>${sales.time}</td>
									<td>${sales.company.name }</td>
									<td>${sales.guide.guidename }</td>
									<td>${sales.address }</td>
									<td>${sales.peoplenum }</td>
									<td>${sales.money }</td>
									<td>${sales.price }</td>
									<td>
										<a href ="sales.jspx?task=edit&id=${sales.id }">
										<i class="icon-edit"></i>
										
										编辑</a>
										<a class="delbtn" href="javascript:void(0)"  rel="${sales.id}">
										<i class="icon-remove-sign"></i>
										
										删除</a>
									
									</td>
								</tr>
							
							</c:forEach>
						</tbody>
					</table>
					<div style="margin-left:50%">
						<span >总条数：${pager.totalNums}</span>
						<span>总人数：${pager.totalpeoplenum}</span>
						<span>销售总金额：${pager.totalMoney}</span>
						<span>客单价：${pager.totalprice}</span>
					
					
					
					</div>
					
					<div class="pagination pull-right">
						<ul>
							<c:choose>
								<c:when test="${pager.pageNum == 1 }">
									<li class="prev disabled">
										<a href="javascript:void(0)" class="prevPage">首页</a>
									</li>	
								</c:when>
								<c:otherwise>
									<li class="prev">
										<a href="javascript:void(0)" class="prevPage">首页</a>
									</li>
								</c:otherwise>
							</c:choose>
							<li><a href="sales.jspx?p=${pager.pageNum-1}">上一页</a></li>
							<li><a href="sales.jspx?p=${pager.pageNum+1 }">下一页</a></li>
							<c:choose>
								<c:when test="${page.totalPages == page.pageNum }">
									<li class="next disabled"><a>尾页 </a></li>
								</c:when>
								<c:otherwise>
									<li class="next"><a href="sales.jspx?p=${page.totalPages }">尾页 </a></li>
								</c:otherwise>
							</c:choose>
						</ul>
					</div>
			</div>
			
			
	<script type="text/javascript">
	
			var removeId ="";
			$(document).ready(function(){
				$(".datepicker").datepicker({
		    			changeMonth:true,
		    			option: $.datepicker.regional["zh-CN"]
		    			
		    		
		    	});
		    	$(".delBtn").click(function(){
		    		removeId = $(this).attr("rel");
		    		$('#myModal2').modal('show');
		    	});
		    	$("#removeBtn").click(function(){
		    		window.location.href="sales.jspx?task=del&id=" + removeId;
		    	});
		    });	
    </script>
			
			
		
  </body>
</html>
